package dj.common.exception;

/**
 * <br>
 * <p>德基：业务中心API运行时异常</p><br>
 *
 * @author ZJG
 * @version 1.0
 * @date 2021/7/7 下午5:06
 */
public class CentralRunException extends BaseRunTimeException {

    /**
     * @param error_msg
     */
    public CentralRunException(String error_msg) {
        super(error_msg);
    }

    /**
     * @param throwable
     */
    public CentralRunException(Throwable throwable) {
        super(throwable);
    }

    /**
     * @param code      异常码 {@link com.dj.common.constants.ResponseStatus}
     * @param message   异常msg
     */
    public CentralRunException(int code, String message) {
        super(code, message);
    }

    /**
     * @param message       异常msg
     * @param throwable     异常详情
     */
    public CentralRunException(String message, Throwable throwable) {
        super(message, throwable);
    }

    /**
     * @param type          业务domain channel 或 biz units业务单元
     * @param throwable     异常详情
     */
    public CentralRunException(Object type, Throwable throwable) {
        super(type.toString(), throwable);
    }

    /**
     * @param type      业务domain channel 或 biz units业务单元
     * @param message   异常msg
     * @param code  {@link com.dj.common.constants.ResponseStatus}
     * @param message
     */
    public CentralRunException(Object type, int code, String message) {
        super(type.toString(), code, message);
    }

    /**
     * @param sysChannel            业务domain channel
     * @param bizUnit               biz units业务单元
     * @param message               异常详情
     */
    public CentralRunException(Object sysChannel, Object bizUnit, String message) {
        super(sysChannel.toString()+ ", " +bizUnit.toString()+ ", " +message);
    }

    /**
     * @param sysChannel            业务domain channel
     * @param bizUnit               biz units业务单元
     * @param throwable               异常详情
     */
    public CentralRunException(Object sysChannel, Object bizUnit, Throwable throwable) {
        super(sysChannel.toString()+ ", " +bizUnit.toString(), throwable);
    }

    @Override
    public String toString() {
        return "CentralRunException: " + code + ": " + message;
    }


}
